import React from 'react';
import {Table, Row, Col, Form, Input, Icon, InputNumber, Radio, DatePicker, Select, Upload, Button, Switch, Modal, Popconfirm, Tabs, message} from 'antd';
import BizParams from '../../components/commons/BizParams'
import SingleDragger from '../../components/commons/SingleDragger'
import CurrencySelect from '../../components/commons/CurrencySelect'
import OperatorConstant from "../../utils/OperatorConstant";

const R = require('ramda');
import moment from 'moment'
const TabPane = Tabs.TabPane;
const FormItem = Form.Item;
const dateFormat = 'YYYY-MM-DD';


export default Form.create({wrappedComponentRef: true})(class Statement extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            open: false,
            disabled: true,
            type: "",
        }
    }

    handleCancel = () => {
        this.props.form.resetFields();
    }



    render() {
        const {getFieldDecorator} = this.props.form;
        const formItemLayout = {labelCol: {xs: {span: 8}, sm: {span: 8}}, wrapperCol: {xs: {span: 15}, sm: {span: 14}}};
        let dataSource = R.isNil(this.props.dataSource) || R.isNil(this.props.dataSource.statement) ? {} : this.props.dataSource.statement;

        let disable = true;
        let disableApproval =this.state.disabled || this.state.type == OperatorConstant.view;

        return (
            <div>
                <Row>
                    <Col span={12}>

                        <FormItem {...formItemLayout} label="结算单号" hasFeedback>
                            {getFieldDecorator('stateno', {
                                initialValue: dataSource.stateno
                            })(
                                <Input style={{width: '100%'}} disabled={disable}/>
                            )}
                        </FormItem>
                    </Col>
                    <Col span={12}>
                        <FormItem {...formItemLayout} label="结算日期" hasFeedback>
                            {getFieldDecorator('createtime', {
                                rules: [{
                                    required: true, message: '请输入费用申报时间',
                                }],
                                initialValue: (dataSource.createtime == '' || dataSource.createtime == null) ? '' : moment(dataSource.createtime, dateFormat)

                            })(
                                <DatePicker
                                    showTime={{format: 'YYYY-MM-DD'}}
                                    format="YYYY-MM-DD"
                                    placeholder="请选择时间"
                                    style={{width: '100%'}} disabled={disable}/>
                            )}
                        </FormItem>
                    </Col>

                    <Col span={12}>
                        <FormItem {...formItemLayout} label="实际支付" hasFeedback>
                            {getFieldDecorator('transferamount', {
                                initialValue: dataSource.transferamount
                            })(
                                <InputNumber style={{width: '100%'}} disabled={disable}/>
                            )}
                        </FormItem>
                    </Col>


                    <Col span={12}>
                        <FormItem {...formItemLayout}  label="收款人"  hasFeedback>
                            {getFieldDecorator('companyName', {

                                initialValue: dataSource.companyName
                            })(
                                <InputNumber style={{width: '100%'}}  disabled={disable}/>
                            )}
                        </FormItem>
                    </Col>
                    <Col span={12}>
                        <FormItem {...formItemLayout} label="银行名称" hasFeedback>
                            {getFieldDecorator('accopenbank', {
                                initialValue: dataSource.accopenbank
                            })(
                                <Input disabled={disable}/>
                            )}
                        </FormItem>
                    </Col>

                    <Col span={12}>
                        <FormItem {...formItemLayout}  label="银行账号"  hasFeedback>
                            {getFieldDecorator('accno', {
                                initialValue: dataSource.accno
                            })(
                                <Input  disabled={disable}/>
                            )}
                        </FormItem>
                    </Col>


                    {/* <Col span={12}>
                        <FormItem {...formItemLayout}  label="代理费收费标准"  hasFeedback >
                            {getFieldDecorator('daili',{
                                initialValue: dataSource.agencyfee
                            })(
                                <Input disabled={disable} />
                            )}
                        </FormItem>
                    </Col> */}

                    <Col span={12}>
                        <FormItem {...formItemLayout}  label="出口备注"  hasFeedback>
                            {getFieldDecorator('memo', {
                                initialValue: dataSource.memo
                            })(
                                <Input.TextArea  disabled={disable} maxLength="200" autosize={true}/>
                            )}
                        </FormItem>
                    </Col>
                </Row>
            </div>

        );

    }
})


